﻿public class NetEvent_UpdateApply : NetEvent
{
    public static NetEvent_UpdateApply NewEvent()
    {
        return new NetEvent_UpdateApply();
    }

    protected override ISerialize NewData() => new UpdateApplyData();


    protected override void Excuate(ISerialize data)
    {
        UpdateApplyData updateData = data as UpdateApplyData;

        GameDebug.Log($"更新Apply：{updateData?.apply.result} ");// delay:{NumsShowController.delayUpdateNumShow}

        MGame.instance.MUser.UpdateApply(updateData.apply);

        if (updateData.apply.result == Apply.ApplyResult_Suc)
        {
            long oppoUserId = updateData.apply.sourceUserId == MGame.instance.MUser.id ?
                updateData.apply.targetUserId : updateData.apply.sourceUserId;

            MGame.instance.MUser.AddFriend(oppoUserId);
        }
    }

}
